#
#  makefile - Linux version of dbExpress driver for Informix makefile
#
#    Copyright (c) 2001-2006, Luxena Software Company. All rights reserved.
#

ifndef VERSIONDIR
VERSIONDIR	= ../..
endif
SOURCE		= $(VERSIONDIR)/source

CC			= g++
CFLAGS		= -DHAVE_CONFIG_H -pipe -O3 -Wall -Wno-deprecated -DIFX_THREAD -D_REENTRANT -s -c
INCLUDEPATH	= -I$(INFORMIXDIR)/incl/esql -I$(SOURCE)/base -I$(SOURCE)/command -I$(SOURCE)/connection \
			  -I$(SOURCE)/metadata -I$(SOURCE)/utilities -I$(SOURCE)/variable
OBJFILES	= $(SOURCE)/base/ifxerror.o $(SOURCE)/base/ifxconversion.o \
			  $(SOURCE)/command/ifxcommand.o $(SOURCE)/command/ifxcursor.o $(SOURCE)/command/ifxparams.o \
			  $(SOURCE)/connection/ifxconnection.o $(SOURCE)/connection/ifxdriver.o \
			  $(SOURCE)/metadata/ifxmetadata.o \
			  $(SOURCE)/utilities/license.o \
			  $(SOURCE)/variable/ifxvariable.o
LD			= g++
LFLAGS		= -shared -s -O3
DYNAMICLIBS	= -L$(INFORMIXDIR)/lib -L$(INFORMIXDIR)/lib/esql \
			  -lthsql \
			  -lthasf \
			  -lthgen \
			  -lthos \
			  -lifgls \
			  -lc \
			  -lm \
			  -ldl \
			  -lcrypt \
			  $(INFORMIXDIR)/lib/esql/checkapi.o \
			  -lifglx \
			  -lpthread \
			  -lpthread
STATICLIBS	= $(INFORMIXDIR)/lib/esql/libthos.a \
			  $(INFORMIXDIR)/lib/esql/libthgen.a \
			  $(INFORMIXDIR)/lib/esql/libthsql.a \
			  $(INFORMIXDIR)/lib/libthasf.a \
			  $(INFORMIXDIR)/lib/esql/libthos.a \
			  $(INFORMIXDIR)/lib/esql/libthgen.a \
			  $(INFORMIXDIR)/lib/esql/libifgls.a \
			  -lc \
			  -lm \
			  -ldl \
			  -lcrypt \
			  $(INFORMIXDIR)/lib/esql/libifglx.a \
			  -lpthread \
			  -lpthread
		  
.cpp.o:
	$(CC) $(CFLAGS) $(INCLUDEPATH) $<
	
build: compile linkdynamic linkstatic clean

compile: $(OBJFILES)

linkdynamic:
	$(LD) $(LFLAGS) -o $(VERSIONDIR)/lib/shared/lxdbexpinfpro.so *.o $(DYNAMICLIBS)

linkstatic:
	$(LD) $(LFLAGS) -o $(VERSIONDIR)/lib/static/lxdbexpinfpro.so *.o $(STATICLIBS)

clean:
	rm -f *.o
